﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.1
// Code is generated on: 2012年10月10日 8:11:47
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET35
// Templates vendor: Solutions Design.
//////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using SD.LLBLGen.Pro.LinqSupportClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

using NetDon.eBoss.Data;
using NetDon.eBoss.Data.DaoClasses;
using NetDon.eBoss.Data.EntityClasses;
using NetDon.eBoss.Data.FactoryClasses;
using NetDon.eBoss.Data.HelperClasses;
using NetDon.eBoss.Data.RelationClasses;

namespace NetDon.eBoss.Data.Linq
{
	/// <summary>Meta-data class for the construction of Linq queries which are to be executed using LLBLGen Pro code.</summary>
	public partial class LinqMetaData : ILinqMetaData
	{
		#region Class Member Declarations
		private ITransaction _transactionToUse;
		private FunctionMappingStore _customFunctionMappings;
		private Context _contextToUse;
		#endregion
		
		/// <summary>CTor. Using this ctor will leave the transaction object to use empty. This is ok if you're not executing queries created with this
		/// meta data inside a transaction. If you're executing the queries created with this meta-data inside a transaction, either set the Transaction property
		/// on the IQueryable.Provider instance of the created LLBLGenProQuery object prior to execution or use the ctor which accepts a transaction object.</summary>
		public LinqMetaData() : this(null, null)
		{
		}
		
		/// <summary>CTor. If you're executing the queries created with this meta-data inside a transaction, pass a live ITransaction object to this ctor.</summary>
		/// <param name="transactionToUse">the transaction to use in queries created with this meta-data</param>
		/// <remarks> Be aware that the ITransaction object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public LinqMetaData(ITransaction transactionToUse) : this(transactionToUse, null)
		{
		}
		
		/// <summary>CTor. If you're executing the queries created with this meta-data inside a transaction, pass a live ITransaction object to this ctor.</summary>
		/// <param name="transactionToUse">the transaction to use in queries created with this meta-data</param>
		/// <param name="customFunctionMappings">The custom function mappings to use. These take higher precedence than the ones in the DQE to use.</param>
		/// <remarks> Be aware that the ITransaction object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public LinqMetaData(ITransaction transactionToUse, FunctionMappingStore customFunctionMappings)
		{
			_transactionToUse = transactionToUse;
			_customFunctionMappings = customFunctionMappings;
		}
		
		/// <summary>returns the datasource to use in a Linq query for the entity type specified</summary>
		/// <param name="typeOfEntity">the type of the entity to get the datasource for</param>
		/// <returns>the requested datasource</returns>
		public IDataSource GetQueryableForEntity(int typeOfEntity)
		{
			IDataSource toReturn = null;
			switch((NetDon.eBoss.Data.EntityType)typeOfEntity)
			{
				case NetDon.eBoss.Data.EntityType.BrandsettingEntity:
					toReturn = this.Brandsetting;
					break;
				case NetDon.eBoss.Data.EntityType.ConfigurationEntity:
					toReturn = this.Configuration;
					break;
				case NetDon.eBoss.Data.EntityType.DictionaryEntity:
					toReturn = this.Dictionary;
					break;
				case NetDon.eBoss.Data.EntityType.DictionarycategoryEntity:
					toReturn = this.Dictionarycategory;
					break;
				case NetDon.eBoss.Data.EntityType.FunctionEntity:
					toReturn = this.Function;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolaccountEntity:
					toReturn = this.Htmltoolaccount;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolaccounttemplateEntity:
					toReturn = this.Htmltoolaccounttemplate;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolcategoryruleEntity:
					toReturn = this.Htmltoolcategoryrule;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolcolorEntity:
					toReturn = this.Htmltoolcolor;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolstyleEntity:
					toReturn = this.Htmltoolstyle;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltooltrademarksettingEntity:
					toReturn = this.Htmltooltrademarksetting;
					break;
				case NetDon.eBoss.Data.EntityType.HtmltoolvocabularyEntity:
					toReturn = this.Htmltoolvocabulary;
					break;
				case NetDon.eBoss.Data.EntityType.ProduccategoryattributeEntity:
					toReturn = this.Produccategoryattribute;
					break;
				case NetDon.eBoss.Data.EntityType.ProductEntity:
					toReturn = this.Product;
					break;
				case NetDon.eBoss.Data.EntityType.ProductcategoryEntity:
					toReturn = this.Productcategory;
					break;
				case NetDon.eBoss.Data.EntityType.ProductgroupEntity:
					toReturn = this.Productgroup;
					break;
				case NetDon.eBoss.Data.EntityType.ProductsummaryEntity:
					toReturn = this.Productsummary;
					break;
				case NetDon.eBoss.Data.EntityType.RoleEntity:
					toReturn = this.Role;
					break;
				case NetDon.eBoss.Data.EntityType.RolefunctionEntity:
					toReturn = this.Rolefunction;
					break;
				case NetDon.eBoss.Data.EntityType.SizesettingEntity:
					toReturn = this.Sizesetting;
					break;
				case NetDon.eBoss.Data.EntityType.StoreEntity:
					toReturn = this.Store;
					break;
				case NetDon.eBoss.Data.EntityType.StorecategoryEntity:
					toReturn = this.Storecategory;
					break;
				case NetDon.eBoss.Data.EntityType.TemplateEntity:
					toReturn = this.Template;
					break;
				case NetDon.eBoss.Data.EntityType.TitlesettingEntity:
					toReturn = this.Titlesetting;
					break;
				case NetDon.eBoss.Data.EntityType.UserEntity:
					toReturn = this.User;
					break;
				case NetDon.eBoss.Data.EntityType.UserroleEntity:
					toReturn = this.Userrole;
					break;
				default:
					toReturn = null;
					break;
			}
			return toReturn;
		}

		/// <summary>returns the datasource to use in a Linq query when targeting BrandsettingEntity instances in the database.</summary>
		public DataSource<BrandsettingEntity> Brandsetting
		{
			get { return new DataSource<BrandsettingEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ConfigurationEntity instances in the database.</summary>
		public DataSource<ConfigurationEntity> Configuration
		{
			get { return new DataSource<ConfigurationEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting DictionaryEntity instances in the database.</summary>
		public DataSource<DictionaryEntity> Dictionary
		{
			get { return new DataSource<DictionaryEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting DictionarycategoryEntity instances in the database.</summary>
		public DataSource<DictionarycategoryEntity> Dictionarycategory
		{
			get { return new DataSource<DictionarycategoryEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting FunctionEntity instances in the database.</summary>
		public DataSource<FunctionEntity> Function
		{
			get { return new DataSource<FunctionEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolaccountEntity instances in the database.</summary>
		public DataSource<HtmltoolaccountEntity> Htmltoolaccount
		{
			get { return new DataSource<HtmltoolaccountEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolaccounttemplateEntity instances in the database.</summary>
		public DataSource<HtmltoolaccounttemplateEntity> Htmltoolaccounttemplate
		{
			get { return new DataSource<HtmltoolaccounttemplateEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolcategoryruleEntity instances in the database.</summary>
		public DataSource<HtmltoolcategoryruleEntity> Htmltoolcategoryrule
		{
			get { return new DataSource<HtmltoolcategoryruleEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolcolorEntity instances in the database.</summary>
		public DataSource<HtmltoolcolorEntity> Htmltoolcolor
		{
			get { return new DataSource<HtmltoolcolorEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolstyleEntity instances in the database.</summary>
		public DataSource<HtmltoolstyleEntity> Htmltoolstyle
		{
			get { return new DataSource<HtmltoolstyleEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltooltrademarksettingEntity instances in the database.</summary>
		public DataSource<HtmltooltrademarksettingEntity> Htmltooltrademarksetting
		{
			get { return new DataSource<HtmltooltrademarksettingEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting HtmltoolvocabularyEntity instances in the database.</summary>
		public DataSource<HtmltoolvocabularyEntity> Htmltoolvocabulary
		{
			get { return new DataSource<HtmltoolvocabularyEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ProduccategoryattributeEntity instances in the database.</summary>
		public DataSource<ProduccategoryattributeEntity> Produccategoryattribute
		{
			get { return new DataSource<ProduccategoryattributeEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ProductEntity instances in the database.</summary>
		public DataSource<ProductEntity> Product
		{
			get { return new DataSource<ProductEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ProductcategoryEntity instances in the database.</summary>
		public DataSource<ProductcategoryEntity> Productcategory
		{
			get { return new DataSource<ProductcategoryEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ProductgroupEntity instances in the database.</summary>
		public DataSource<ProductgroupEntity> Productgroup
		{
			get { return new DataSource<ProductgroupEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting ProductsummaryEntity instances in the database.</summary>
		public DataSource<ProductsummaryEntity> Productsummary
		{
			get { return new DataSource<ProductsummaryEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting RoleEntity instances in the database.</summary>
		public DataSource<RoleEntity> Role
		{
			get { return new DataSource<RoleEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting RolefunctionEntity instances in the database.</summary>
		public DataSource<RolefunctionEntity> Rolefunction
		{
			get { return new DataSource<RolefunctionEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting SizesettingEntity instances in the database.</summary>
		public DataSource<SizesettingEntity> Sizesetting
		{
			get { return new DataSource<SizesettingEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting StoreEntity instances in the database.</summary>
		public DataSource<StoreEntity> Store
		{
			get { return new DataSource<StoreEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting StorecategoryEntity instances in the database.</summary>
		public DataSource<StorecategoryEntity> Storecategory
		{
			get { return new DataSource<StorecategoryEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting TemplateEntity instances in the database.</summary>
		public DataSource<TemplateEntity> Template
		{
			get { return new DataSource<TemplateEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting TitlesettingEntity instances in the database.</summary>
		public DataSource<TitlesettingEntity> Titlesetting
		{
			get { return new DataSource<TitlesettingEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting UserEntity instances in the database.</summary>
		public DataSource<UserEntity> User
		{
			get { return new DataSource<UserEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		/// <summary>returns the datasource to use in a Linq query when targeting UserroleEntity instances in the database.</summary>
		public DataSource<UserroleEntity> Userrole
		{
			get { return new DataSource<UserroleEntity>(_transactionToUse, new ElementCreator(), _customFunctionMappings, _contextToUse); }
		}
		
		#region Class Property Declarations
		/// <summary> Gets / sets the ITransaction to use for the queries created with this meta data object.</summary>
		/// <remarks> Be aware that the ITransaction object set via this property is kept alive by the LLBLGenProQuery objects created with this meta data
		/// till they go out of scope.</remarks>
		public ITransaction TransactionToUse
		{
			get { return _transactionToUse;}
			set { _transactionToUse = value;}
		}

		/// <summary>Gets or sets the custom function mappings to use. These take higher precedence than the ones in the DQE to use</summary>
		public FunctionMappingStore CustomFunctionMappings
		{
			get { return _customFunctionMappings; }
			set { _customFunctionMappings = value; }
		}
		
		/// <summary>Gets or sets the Context instance to use for entity fetches.</summary>
		public Context ContextToUse
		{
			get { return _contextToUse;}
			set { _contextToUse = value;}
		}
		#endregion
	}
}